package com.ssms.controller;

import com.ssms.commons.Result;
import com.ssms.commons.TablePage;
import com.ssms.model.Academy;
import com.ssms.model.SysUser;
import com.ssms.service.AcademyService;
import com.ssms.service.NoticeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/notice")
public class NoticeController {

    @Resource
    private NoticeService noticeService;

    @RequestMapping()
    public String notice() {
        return "notice";
    }

    @RequestMapping("list")
    @ResponseBody
    public TablePage list(TablePage tablePage, HttpSession session) {
        SysUser sysUser = (SysUser) session.getAttribute("sysUser");
        return noticeService.search(tablePage, sysUser.getId());
    }

    @RequestMapping("getCount")
    @ResponseBody
    public Result getCount(HttpSession session) {
        SysUser sysUser = (SysUser) session.getAttribute("sysUser");
        return noticeService.getCount(sysUser.getId());
    }

}
